﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PolymorphExample
{
    class Program
    {
        static void Main(string[] args)
        {
            //Shape shape = new Shape() {Height = 5, Width = 5}; //Ошибка! Нельзя создавать экземпляр абстрактного класса
            Rectangle rectangle = new Rectangle() { Height = 15, Width = 10};
            Circle circle = new Circle() { Height = 15, Width = 10 };

            rectangle.Draw();
            circle.Draw();

            Console.WriteLine();
            Console.WriteLine("Draw shapes from List:");
            Console.WriteLine();


            List<Shape> shapes = new List<Shape>();
            shapes.Add(rectangle);
            shapes.Add(circle);

            foreach (var shapeInList in shapes)
            {
                shapeInList.Draw();
                shapeInList.PrintSizes();
            }
        }
    }
}
